﻿using Design.Common.Attri;
using Design.Common.Interface;
using Design.Common.Model;
using FactoryMethodPattern.Factory;
using System.Reflection;

namespace FactoryMethodPattern
{
    [DesignAttribute(nameof(FactoryMethodDemo), DesignType.Creation,(int)CreationType.FactoryMethod)]
    public class FactoryMethodDemo : IDesignDemo
    {
        public DesignAttribute GetDesignAttribute() => typeof(FactoryMethodDemo).GetCustomAttribute<DesignAttribute>();

        public void RunExample(bool isRun)
        {
            if (!isRun) return;
            new AUDIFactory().CreateProduct();
            new BYDFactory().CreateProduct();
        }
    }
}